package cn.tedu.live8.controller;

import cn.tedu.live8.mapper.AdminCategroyMapper;
import cn.tedu.live8.pojo.dto.AdminCategroyDTO;
import cn.tedu.live8.pojo.dto.AdminSeriesContentDTO;
import cn.tedu.live8.pojo.dto.AdminSeriesDTO;
import cn.tedu.live8.pojo.entity.AdminSeriesContent;
import cn.tedu.live8.pojo.vo.AdminCategroyVO;
import cn.tedu.live8.pojo.vo.AdminSeriesContentVO;
import cn.tedu.live8.pojo.vo.AdminSeriesVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/admin/Categroy")
public class AdminCategroyController {
    @Autowired
    AdminCategroyMapper mapper;

    @RequestMapping("/list")
    public List<AdminCategroyVO> list(){
        log.debug("列表c");
       return mapper.list();
    }
    @RequestMapping("/contentList")
    public List<AdminSeriesContentVO> contentList(){
        log.debug("列表c");
        return mapper.contentList();
    }

    @RequestMapping("/seriesList")
    public List<AdminSeriesVO> seriesList(){
        log.debug("列表c");
        return mapper.seriesList();
    }


    @RequestMapping("/addNew")
    public int insert(@RequestBody AdminCategroyDTO adminCategroyDTO){
        System.out.println("添加c+"+adminCategroyDTO.getCategroyId());
        return mapper.insert(adminCategroyDTO);
    }

    @RequestMapping("/contentAddNew")
    public int contentAdd(@RequestBody AdminSeriesContentDTO adminSeriesContentDTO){
        System.out.println("添加c+"+adminSeriesContentDTO.getSeriesId());
        return mapper.contentAdd(adminSeriesContentDTO);
    }

    @RequestMapping("/update")
    public int update(@RequestBody AdminCategroyDTO adminCategroyDTO){
        log.debug("修改c+"+adminCategroyDTO.getCategroyId());
        return mapper.update(adminCategroyDTO);
    }

    @RequestMapping("/deleteByid")
    public int deleteByid(int id){
        log.debug("删除c");
        return mapper.deleteByid(id);
    }
    @RequestMapping("/seriesDeleteByid")
    public int seriesDeleteByid(int id){
        log.debug("删除c");
        return mapper.seriesDeleteByid(id);
    }
    @RequestMapping("/contentDeleteByid")
    public int contentDeleteByid(int id){
        log.debug("删除c");
        return mapper.contentDeleteByid(id);
    }
    @RequestMapping("/Seriesupdate")
    public int Seriesupdate(@RequestBody AdminSeriesDTO adminSeriesDTO){
        log.debug("修改c+"+adminSeriesDTO.getSeriesIntro());
        return mapper.Seriesupdate(adminSeriesDTO);
    }
    @RequestMapping("/ContentUpdate")
    public int ContentUpdate(@RequestBody AdminSeriesContentDTO adminSeriesContentDTO){
        log.debug("修改c+"+adminSeriesContentDTO.getSeriesId());
        return mapper.ContentUpdate(adminSeriesContentDTO);
    }






}
